import com.mongodb.client.MongoDatabase;
import com.mongodb.MongoClient;

public class DatabaseControl {
    private static DatabaseControl _instance;

    private MongoDatabase gameServers;

    public static DatabaseControl Instance() {
        if (_instance == null) {
            _instance = new DatabaseControl();
        }

        return _instance;
    }

    public void init() {
        //TODO:这里的IP、端口，数据库名字都可以用配置文件配置
        MongoClient mongo = new MongoClient("localhost" , 27017);

        gameServers = mongo.getDatabase("GameServers");
    }


    public MongoDatabase getGameServersDatabase () {
        return gameServers;
    }
}
